home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Linux Cubed Series 2: Applications
/
Linux Cubed Series 2 - Applications.iso
/
math
/
gle-3.000
/
gle-3
/
gle
/
manual
/
gle.txt
Wrap
Text File
|
1995-02-07
|
70KB
|
1,930 lines
Abstract
--------
GLE is a high quality graphics package for scientists,
combining a user friendly interface with a full range of
facilities for producing publication quality graphs,
diagrams, posters and slides.
GLE provides LaTeXquality fonts together with a flexible
graphics module which allows the user to specify any
feature of a graph (down to the line width of the subticks,
for example)
Complex pictures can be drawn with user defined subroutines
and simple looping structures.
Current device drivers support DECWINDOWS, REGIS, TEK4010,
all PC graphics cards, VT100s, HP-Plotters, PostScript
Printers, EPSON Printers and LaserJet Printers.
GLE runs on both VAXes and PCs, giving an identical user
interface on both platforms.
GLE Installation on a PC
------------------------
To install GLE, put the distribution disk into drive a: and
type:
a:install
GLE requires at least 800K of disk space for a minimal
installation and 3.3M for a full installation (including
all device drivers and fonts).
GLE also requires 530K or more of free memory. Use the DOS
command CHKDSK to check this figure. If you don't have
enough then take copies of your AUTOEXEC.BAT and CONFIG.SYS
files and then remove as much as possible from these files.
GLE may work with less memory depending on what you are
drawing.
The installation disk contains a version of CGLE which will
make use of epanded memory. This version can run with 70K
less memory but if you don't have expanded memory then it
has to use your hard disk instead which is a great deal
slower.
Running GLE
-----------
To get GLE running interactively you must be on a
VAXstation, graphics terminal, or PC. If you are using a PC
you should make certain you have an up to date copy of GLE
(ask via VAX-mail to GRV::SRGHCXP or InterNET
srghcxp@grv.dsir.govt.nz)
Running GLE on a PC
-------------------
The command to run GLE is:
C:\GLE> cgle myfile.gle
Note: the command is `CGLE' not `GLE' but the directory is
`GLE', this is for historical reasons.
To print a GLE file to the laser printer you would type:
C:> psgle myfile
C:> print myfile.ps
To produce an .eps file for inclusion in WordPerfect you
would type:
C:> psgle myfile /eps
This will create a file called myfile.EPS.
If your PC is connected to a VAX computer which has a
PostScript printer you may copy MYFILE.PS to the VAX using
a standard file transfer program (e.g. FTP, KERMIT, VDISK)
The best way to see what GLE can do is to have a play with
it, simply start it up and try out some of the examples:
Press F3 (Load file)
Press <enter> (for a menu of GLE files)
Use arrow keys to select example, then press <enter>
Press F10 to draw the picture
Press ESC to get back to the GLE editor.
...
When you find a graph try pressing F9 and modifying
one of the fields (use F1 for an explanation of each
field).
Running GLE on a VAX
--------------------
The command to run GLE is:
$ cgle myfile.gle
$ cgle myfile.gle /dev=regis
$ cgle myfile.gle /dev=x
See the directory CGLE_EXAMPLES: for examples and
templates. To get access to these files from the GLE menus
use the commands:
$ define workarea sys$login:,cgle_examples:
$ set default workarea:
$ cgle stack4b.gle ! or any other example
If your keyboard doesn't have the function keys F9 thru F14
you can use GOLD (PF1) followed by the numbers 9,0,1,2,3,4
(on the top of the QWERTYUIOP keypad).
Keyboard Mappings:
VT100 VT200 PC Meaning
GOLD 1 F11 F1 Help
GOLD 2 F12 F2 Save
GOLD 3 F13 F3 Load
GOLD 4 F14 F4 Save-as
GOLD 9 F9 F9 Graph-menu
GOLD 0 F10 F10 Draw-it
Control+Z Control+Z Control+Z Exit/Escape
Alt+X Exit/Escape
Control+E Control+E Calls VAX EDT
Control+F Control+F Toggle fast/slow text
Control+R Control+R F5 Shows errors
Control+S Shells to DOS
Supported devices: VT100, REGIS (VT125, VT240), TEK4010,
VWS, XWindows.
Supported output: PostScript, HPGL, Epson, Epson 24pin, HP
Deskjet.
To create a PostScript output file (.PS) and automatically
print it to the LASER queue you would type:
$ cgle myfile /print
To produce an .eps file for inclusion in LaTeXyou would
type:
$ cgle myfile /dev=eps
To produce a .ps file suitable for printing to a laser
writer type:
$ cgle myfile /dev=ps
It didn't work, bugs!!!
-----------------------
If the installation fails, or one of the example GLE files
fails to work then the most likely reason is a shortage of
memory due to too many memory resident programs/drivers. To
fix this remove these utilities from your autoexec.bat and
config.sys files temporarily.
There may well be a bug in your GLE file, try using the
trace option to find the bug.
On a PC:
C:\GLE> psgle myfile /trace
On a VAX:
$ cgle myfile /dev=ps /trace
Another reason for a failure is a bug in GLE, Please report
bugs to Chris Pugmire (in%"srghcxp@grv.dsir.govt.nz",
grv::srghcxp) so they can be fixed. If possible, try and
find a way of repeating the problem, then send relevant GLE
and data files with an outline of what is wrong.
Drawing a Line on a Page
------------------------
Let's start with drawing a line on the page. GLE has to
know what size piece of paper you are working with. You can
tell it by giving a size command:
size 18 27
This specifies a piece of paper 18cm wide and 27cm high.
Now you must define a current point by moving to somewhere
on the page:
amove 2 4
The origin (0,0) is at the bottom left hand corner of the
page. Now suppose we wish to draw a line from this point
across 1 cm and up 2 cm:
size 18 27
amove 2 4
rline 1 2
That was a relative movement as the x and y values were
given as distances from the current point, alternatively we
could have used absolute coordinates:
size 18 27
amove 2 4
aline 3 6 ! absolute.
Now if you want to draw some text on this page at the
current point you would use the text command:
text Hi there
So we have now constructed an entire GLE program as
follows, with the results illustrated below:
size 12 8 box
amove 2 4
rline 1 2
text Hi there
Drawing a Simple Graph
----------------------
This section will describe how to go about drawing a simple
graph.
The following data points are contained in a file called
TUT.DAT
x y
----- (These top two lines do not appear in the file)
1 2
2 6
3 2
4 5
5 9
The data is in two columns with white space separating each
column of numbers. The following commands will draw a
simple line graph of the data.
size 6 3
begin graph
size 6 3
data tut.dat
yaxis min 0
d1 line marker star msize .2
end graph
The first size command defines the size of the piece of
paper which may contain several graphs. The second defines
the size of this particular graph. The actual graph axes
are by default 0.7 of these dimensions. The ratio can be
changed with the vscale and hscale commands.
Without the "yaxis min 0" command the yaxis would start at
2.0, because that is the minimum y value in the data. This
makes the graph easier to interpret.
Changing the above d1 command to:
d1 line marker circle
will mark each data point with a circle instead of a star.
See appendix A for a list of other marker names.
A smooth line can be drawn between the data points by
changing the d1 command to:
d1 line marker circle smooth
The order of the commands is not important, except that
circle is a parameter for the qualifier marker and
therefore must come straight after it. E.g., d1 [marker
circle] [line smooth] [color blue]
GLE Primitives
--------------
A GLE command is a sequence of keywords and values
separated by white space (one or more spaces or tabs). Each
command must begin on a new line. Keywords may not be
abbreviated, the case is not significant. All coordinates
are expressed in centimetres from the bottom left corner of
the page.
GLE uses the concept of a current point which most commands
use. For example, the command aline 2 3 will draw a line
from the current point to the coordinates (2,3).
The current graphics state also includes other settings
like line width, color, font, 2d transformation matrix. All
of these can be set with various GLE commands.
Graphics Primitives (a summary)
-------------------------------
! comment
@ xxx
aline x y [arrow start] [arrow end] [arrow both]
amove x y
arc radius a1 a2
arcto x1 y1 x2 y2 rad
begin box [fill pattern] [add gap] [nobox] [name xyz]
begin clip
begin origin
begin path [stroke] [fill pattern] [clip]
begin rotate angle
begin scale x y
begin table
begin text [width exp]
begin translate x y
bezier x1 y1 x2 y2 x3 y3
bigfile filename.gle
box x y [justify jtype] [fill color] [name xxx] [nobox]
circle radius [fill pattern]
closepath
curve ix iy [ x1 y1 x y x y ... xn yn] ex ey
define marker markername subroutine-name
for var = exp1 to exp2 [step exp3] command [...] next var
grestore
gsave
if exp then command [...] else command [...] end if
include filename
join object1.just sep object2.just
marker marker-name [ scale-factor]
postscript filename.eps width-exp height-exp
rbezier x1 y1 x2 y2 x3 y3
return exp
reverse
rline x y [arrow end] [arrow start] [arrow both]
rmove x y
save objectname
set cap butt | round | square
set color col
set dashlen dashlen-exp
set font font-name
set fontlwidth line-width
set hei character-size
set join mitre | round | bevel
set just left | center | right | tl | etc...
set lstyle line-style
set lwidth line-width
sub sub-name paramter1 paramter2 etc
text unquoted-text-string
write string$
Graphics Primitives (in detail)
-------------------------------
! comment
Indicates the start of a comment. GLE ignores everything
from the exclamation point to the end of the line.
@ xxx
Executes subroutine xxx.
aline x y [arrow start] [arrow end] [arrow both]
Draws a line from the current point to the absolute
coordinates (x,y), which then becomes the new current
point. The arrow qualifiers are optional, they draw arrows
at the start or end of the line, the size of the arrow is
proportional to the current font height.
amove x y
Changes the current point to the absolute coordinates
(x,y).
arc radius a1 a2
Draws an arc of a circle in the anti-clockwise direction,
centered at the current point, of radius radius, starting
at angle a1 and finishing at angle a2. Angles are specified
in degrees. Zero degrees is at three o'clock and Ninety
degrees is at twelve o'clock.
arc 1.2 20 45
The command narc is identical but draws the arc in the
clockwise direction. This is important when constructing a
path.
arcto x1 y1 x2 y2 rad
Draws a line from the current point to (x1,y1) then to
(x2,y2) but fits an arc of radius rad joining the two
vectors instead of a vertex at the point (x1,y1).
begin block_name ... end block_name
There are several block structured commands in GLE. Each
begin must have a matching end. Blocks which change the
current graphics state (e.g. scale, rotate, clip etc) will
restore whatever they change at the end of the block.
Indentation is optional but should be used to make the GLE
program easier to read.
begin box [fill pattern] [add gap] [nobox] [name xyz]
Draws a box around everything between begin box and end
box. The option add adds a margin of margin cm to each side
of the box to make the box slightly larger than the area
defined by the graphics primitives in the begin box end box
group (to leave a gap around text for example). The option
nobox stops the box outline from being drawn.
The name option saves the coordinates of the box for later
use with the join command.
begin clip
This saves the current clipping region. A clipping region
is an arbitrary path made from lines and curves which
defines the area on which drawing can occur. This is used
to undo the effect of a clipping region defined with the
begin path command. See the example CLIP.GLE in appendix B
at the end of the manual.
begin origin
This makes the current point the origin. This is good for
subroutines or something which has been drawn using
amove,aline. Everything between the begin origin and end
origin can be moved as one unit. The current point is also
saved and restored.
begin path [stroke] [fill pattern] [clip]
Initialises the drawing of a filled shape. All the lines
and curves generated until the next end path command will
be stored and then used to draw the shape. stroke draws the
outline of the shape, fill paints the inside of the shape
in the given color and clip defines the shape as a clipping
region for all future drawing. Clipping and filling will
only work on PostScript devices.
begin rotate angle
The coordinate system is rotated anti-clockwise about the
current point by the angle angle (in degrees). For example,
to draw a line of text running vertically up the page (as a
Y axis label, say), type:
begin scale x y
Everything between the begin and end is scaled by the
factors x and y. E.g., scale 2 3 would make the picture
twice as wide and three times higher.
begin table
This module is an alternative to the TEXT module. It reads
the spaces and tabs in the source file and aligns the words
accordingly. A single space between two words is treated as
a real space, not an alignment space.
With a proportionally spaced font columns will line up on
the left hand side but not on the right hand side. However
with a fixed pitch font, like tt, everything will line up.
begin text [width exp]
This module displays multiple lines/paragraphs of text. The
block of text is justified according to the current justify
setting. See the set just command for a description of
justification settings.
If a width is specified the text is wrapped and justified
to the given width. If a width is not given, each line of
text is drawn as it appears in the file. Remember that GLE
treats text in the same way that LaTeXdoes, so multiple
spaces are ignored and some characters have special
meaning. E.g, \ ^ _ & { }
To include Greek characters in the middle of text use a
backslash followed by the name of the character. E.g.,
3.3\Omega S would produce ``3.3OS''.
To put a space between the Omega and the S add a backslash
space at the end. E.g., 3.3\Omega\ S produces ``3.3O S''
Sometimes the space control characters (e.g. \:) are also
ignored, this may happen at the beginning of a line of
text. In this case use the control sequence \glasswhich
will trick GLE into thinking it isn't at the beginning of a
line. E.g.,
text \glass \:\: Indented text
There are several LaTeXlike commands which can be used
within text, they are:
^{} Superscript
_{} Subscript
\\ Forced Newline
\_ Underscore character
\, .5em (em = width of the letter `m')
\: 1em space
\; 2em space
\char{22} Any character in current font
\chardef{a}{hello} Define a character as a macro
\def\v{hello} Defines a macro
\movexy{2}{3} Moves the current text point
\glass Makes move/space work on beginning of line
\rule{2}{4} Draws a filled in box, 2cm by 4cm
\setfont{rmb} Sets the current text font
\sethei{.3} Sets the font height (in cm)
\setstretch{2} Scales the quantity of glue between words
\lineskip{.1} Sets the default distance between lines of text
\linegap{-1} Sets the minimum required gap between lines
begin translate x y
Everything between the begin and end is moved x units to
the right and y units up.
bezier x1 y1 x2 y2 x3 y3
Draws a Bezier cubic section from the current point to the
point (x3,y3) with Bezier cubic control points at the
coordinates (x1,y1) and (x2,y2). For a full explanation of
Bezier curves see the PostScript Language Reference Manual.
bigfile filename.gle
This command reads the file one line at a time, compiles
each line and executes it. This means it can read any sized
file. However, complex multi-line commands cannot be used.
Subroutines can be used but not defined, inside the
bigfile. Note: there is also a bigfile option in the
graphing module for large datasets.
box x y [justify jtype] [fill color] [name xxx] [nobox]
Draws a box, of width x and height y, with its bottom left
corner at the current point. If the justify option is used,
the box will be positioned relative to the specified point.
E.g., TL = top left, CC = center center, BL = bottom left,
CENTRE = bottom centre, RIGHT = bottom right, LEFT = bottom
left. See set just for a description of justification
settings.
If a fill pattern is specified, the box will be filled.
Remember that white fill is different from no fill pattern
- white fill will erase anything that was inside the box.
circle radius [fill pattern]
Draws a circle at the current point, with radius radius. If
a fill pattern is specified the circle will be filled.
closepath
Joins the beginning of a line to the end of a line. I.e.,
it does an aline to the end of the last amove.
curve ix iy [ x1 y1 x y x y ... xn yn] ex ey
Draws a curve starting at the current point and passing
through the points (x1,y1) (xn,yn), with an initial slope
of (ix,iy) to (x1,y1) and a final slope of (ex,ey). All the
vectors are relative movements from the vector before.
define marker markername subroutine-name
This defines a new marker called markername which will call
the subroutine subroutine-name whenever it is used. It
passes two parameters, the first is the requested size of
the marker and the second is a value from a secondary
dataset which can be used to vary size or rotation of a
marker for each point plotted.
for var = exp1 to exp2 [step exp3] command [...] next var
The for ... next structure lets you repeat a block of
statements a number of times.
GLE sets var equal to exp1 and then repeats the following
steps.
If var is greater than exp2 then GLE commands are skipped
until the line after the next statement.
The value exp3 is added to var.
The statements between the for and next statement are
executed. itemize
If exp1 is greater than exp2 then the loop is not executed.
grestore
Restores the most recently saved graphics state. This is
the simplest way to restore complicated transformations
such as rotations and translations. It must be paired with
a previous gsave command.
gsave
Saves the current graphics transformation matrix and the
current point and the current color, font etc.
if expression then command [...] else command [...] end if
If expression evaluates to true, then execution continues
with the statements up to the corresponding else, otherwise
the statements following the else and up to the
corresponding end if are executed.
amove 3 3
if xpos()=3 then
text We are at x=3
else
text We are elsewhere
end if
Note: end if is not spelt endif.
include filename
The commands in filename are read just as if they were in
the current GLE file. With a large include file GLE may run
out of memory. If this happens, use the bigfile command
instead of include. Note: there is also a bigfile option in
the graphing module.
join object1.just sep object2.just
Draws a line between two named objects. An object is simply
a point or a box which was given a name when it was drawn.
The justify qualifiers are the standard GLE justification
abbreviations (e.g. TL=top left, see set just for details)
If sep is written as -, a line is drawn between the named
objects e.g.
join fred.tr - mary.tl
Arrow heads can be included at both ends of the line by
writing sep as <->. Single arrow heads are produced by <-
and ->. Note that sep must be separated from object1.just
and object2.just by white space.
If the justification qualifiers are omitted, a line will be
drawn between the centres of the two objects (clipped at
the edges of the rectangles which define the objects).
See Chapter 5 for an example of joining objects.
marker marker-name [ scale-factor]
Draws marker marker-name at the current point. The size of
the marker is proportional to the current font size, scaled
by the value of scale-factor if present. Markers are
referred to by name, eg. square, diamond, triangle and
fcircle. Markers beginning with the letter f are usually
filled variants. Markers beginning with w are filled with
white so lines are not visible through the marker. For a
complete list of markers refer to Appendix A.1.
postscript filename.eps width-exp height-exp
Includes an encapsulated postscript file into a GLE
picture, the postscript picture will be scaled up or down
to fit the width given. On the screen you will just see a
rectangle.
Only the width-exp is used to scale the picture so that the
aspect ratio is maintained. The height is only used to
display a rectangle of the right size on the screen.
rbezier x1 y1 x2 y2 x3 y3
This command is identical to the BEZIER command except that
the points are all relative to the current point.
return exp
The return command is used inside subroutines to return a
value.
reverse
Reverses the direction of the current path. This is used
when filling multiple paths in order that the Non-Zero
Winding Rule will know which part of the path is `inside'.
With the Non-Zero Winding Rule an imaginary line is drawn
through the object. Every time a line of the object crosses
it from left to right, one is added to the counter; every
time a line of the object crosses it from right to left,
one is subtracted from the counter. Everywhere the counter
is non-zero is considered to be the `inside' of the drawing
and is filled.
rline x y [arrow end] [arrow start] [arrow both]
Draws a line from the current point to the relative
coordinates (x,y), which then become the new current point.
If the current point is (5,5) then rline 3 -2 is equivalent
to aline 8 3. The optional qualifiers on the end of the
command will draw arrows at one or both ends of the line,
the size of the arrow head is proportional to the current
font size.
rmove x y
Changes the current point to the relative coordinate (x,y).
If the current point is (5,5) then rmove 3 -2 is equivalent
to amove 8 3.
save objectname
This command saves a point for later use with the join
command.
set cap butt | round | square
Defines what happens at the end of a wide line.
set color col
Sets the current color for all future drawing operations.
There are several pre-defined colors which can be specified
by name.
black, white, red, green, blue, cyan, magenta, yellow,
grey10, grey20 ... grey90, shade1 ... shade5, grid1 ...
grid5
It is also possible to specify a grey scale as an
expression with 0.0 = black and 1.0 = white.
set dashlen dashlen-exp
Sets the length of the smallest dash used for the line
styles. This command MUST come before the set lstyle
command. This may be needed when scaling a drawing by a
large factor.
set font font-name
Sets the current font to font-name. Valid font-names are
listed in Appendix A.2.
There are three types of font: PostScript, LaTeXand
Plotter. They will all work on any device, however
LaTeXfonts are drawn in outline on a plotter, and so may
not look very nice. PostScript fonts will be emulated by
LaTeXfonts on non-PostScript printers.
set fontlwidth line-width
This sets the width of lines to be used to draw the stroked
(Plotter fonts) on a PostScript printer. This has a great
effect on their appearance.
set hei character-size
Sets the height of text. For historical reasons, concerning
lead type and printing conventions, a height of 10cm
actually results in capital letters about 6.5cm tall.
set join mitre | round | bevel
Defines how two wide lines will be joined together. With
mitre, the outside edges of the join are extended to a
point and then chopped off at a certain distance from the
intersection of the two lines. With round, a curve is drawn
between the outside edges.
set just left | center | right | tl | etc...
Sets the justification which will be used for text
commands.
set lstyle line-style
Sets the current line style to line style number
line-style. There are 9 predefined line styles (1--9). When
a line style is given with more than one digit the first
digit is read as a run length in black, the second a run
length in white, the third a run length in black, etc.
set lwidth line-width
Sets the width of lines to line-width cm. A value of zero
will result in the device default of about 0.02 cm, so a
lwidth of .0001 gives a thinner line than an lwidth of 0.
sub sub-name parameter1 parameter2 etc
Defines a subroutine. The end of the subroutine is denoted
with end sub. Subroutines must be defined before they are
used.
Subroutines can be called inside any GLE expression, and
can also return values. The parameters of a subroutine
become local variables. Subroutines are reentrant.
sub tree x y a$
amove x y
rline 0 1
write a$
return x/y
end sub
@tree 2 4 "mytree" (Normal call to subroutine)
slope = tree(2,4,"mytree") (Using subroutine in an expression)
text unquoted-text-string
This is the simplest command for drawing text. The current
point is unmodified after the text is drawn so following
one text command with another will result in the second
line of text being drawn on top of the first. To generate
multiple lines of text, use the begin text end text
construct.
text "Hi, how's tricks", said Jack!
write string$
This command is similar to text except that it expects a
quoted string, string variable, or string expression as a
parameter.
The built in functions sqrt() and time$() are described in
appendix A.3.
commanddescription
Expressions
-----------
Wherever GLE is expecting a number it can be replaced with
an expression. For example
rline 3 2
and
rline 9/3 sqrt(4)
will produce the same result.
An expression in GLE is delimited by white space, so it may
not contain any spaces - ` rline 3*3 2' is valid but `
rline 3 * 3 2' will not work.
Or ` let d2 = 3+sin(d1)' will work and ` let d2= 3 +
sin(d1) ' won't.
Expressions may contain numbers, arithmetic operators ( +,
-, *, /, ^(to the power of)), relational operators ( >, <,
=>, <=, =, <>) boolean operators ( AND, OR), variables and
built-in functions.
When GLE is expecting a color or marker name (like `green'
or `circle') it can be given a string variable, or an
expression enclosed in braces).
GLE provides a large number of built in functions, these
are listed in Appendix A.3.
Functions Inside Expressions
----------------------------
xg(), yg()
With these functions it is possible to move to a position
on a graph using the graph's axis units. To draw a filled
box on a graph, at position x=948, y=.004 measured on the
graph axis:
begin graph
xaxis min 100 max 2000
yaxis min -.01 max .01
...
end graph
amove xg(948) yg(.004)
box 2 2 fill grey10
xend(), yend()
These functions return the end point of the last thing
drawn. This is of particular interest when drawing text.
text abc
set color blue
text def
This would draw the def on top of the abc. To draw the def
immediately following the abc simply do the following (Note
that absolute move is used, not relative move):
xpos(), ypos()
Returns the current x and y points. commanddescription
The Graph Module
----------------
A graph should start with begin graph and end with end
graph. The data to be plotted are organised into datasets.
A dataset consists of a series of (X,Y) coordinates, and
has a name based on the letter ``d'' and a number between 1
and 99, eg. d1
The name dn can be used to define a default for all
datasets. Many graph commands described below start with d
n. This would normally be replaced by a specific dataset
number e.g.,
d3 marker diamond
For each xaxis command there is a corresponding yaxis,
y2axis and x2axis command for setting the top left and
right hand axes. These commands are not explicitly
mentioned in the following descriptions.
Graph Commands (a summary)
--------------------------
data filename [d1 d2 d3 ... ] [d1=c1,c3 ]
dn bigfile "all.dat,xc,yc" [marker mname] [line]
dn err d5 errwidth width-exp errup nn% errdown d4
dn herr d5 herrwidth width-exp herrleft nn% errright d4
dn key "Dataset title"
dn line
dn lstyle line-style lwidth line-width color col
dn marker marker-name [msize marker-size] [mdata dn]
dn nomiss
dn smooth | smoothm
dn xmin x-low xmax x-high ymin y-low ymax y-high
fullsize
hscale exp
key pos tl nobox hei exp offset xexp yexp
let ds = exp [from low to high step exp ]
nobox
size x y
title "title" [hei ch-hei] [color col] [font font] [dist
cm]
vscale exp
x2labels on
xaxis | yaxis | x2axis | y2axis
xaxis color col font font-name hei exp-cm lwidth exp-cm
xaxis dsubticks sub-distance
xaxis grid
xaxis log
xaxis min low max high dpoints n
xaxis nofirst nolast
xaxis nticks number dticks distance
xaxis off
xaxis shift cm-exp
xlabels font font-name hei char-hei color col
xnames "name" "name" ...
xplaces pos1 pos2 pos3 ...
xside color col lwidth line-width off
xsubticks lstyle num lwidth exp length exp off
xticks lstyle num lwidth exp length exp off
xtitle "title" [hei ch-hei] [color col] [font font] [dist
cm]
y2title "text-string" [rotate]
bar dx,... dist spacing
bar dx,... from dy,...
bar dn,... width xunits,... fill col,... color col,...
fill x1, d3 color green xmin val xmax val
fill d4,x2 color blue ymin val ymax val
fill d3,d4 color green xmin val xmax val
fill d4 color green xmin val xmax val
Graph Commands (in detail)
--------------------------
data filename [d1 d2 d3 ... ] [d1=c1,c3 ]
Specifies the name of a file to read data from. By default,
the data will be read into the next free datasets unless
the optional specific dataset names are specified.
A dataset consists of a series of (X,Y) coordinates, and
has a name based on the letter d and a number between 1 and
99, e.g. d1 or d4. Up to 99 datasets may be defined.
From a file with 3 columns the command ` data xx.dat' would
read the first and second columns as the x and y values for
dataset 1 (d1) and the first and third columns as the x and
y values for dataset 2 (d2). The next data command would
use dataset 3 (d3).
A data file for two datasets looks like this (*=missing
value):
1 2.7 3
2 5 *
3 7.8 7
4 9 4
The first coordinate of dataset d1 would then be ( 1,2.7)
and the first coordinate of dataset d2 would be ( 1,3).
The option d3=c2,c3 allows particular columns of data to be
read into a dataset, d3 would read x values from column 2
and y values from column 3.
dn bigfile "all.dat,xc,yc" [marker mname] [line]
The bigfile option allows a dataset to be read as it is
drawn, (rather than being complete read into memory before
it is drawn) this means that very large datasets can be
drawn on a PC without running out of memory. The axis
minimum and maximum must be specified (using the command
xaxis min exp max exp.
By default the first two columns of the data file will be
read in, but other columns may be specified. E.g.,
all.dat,3,2 would read x values from column 3 and y values
from column 2. Or, to read the 4th dataset, specify the
file as all.dat,1,5
If the x column is specified as '0' then GLE will generate
the x data points. E.g., 1,2,3,4,5...
Many (but not all) of the normal dn commands can be used
with the bigfile command. E.g., marker, lstyle, xmin, xmax,
ymin, ymax, color and lwidth. You cannot use commands like
let or bar with the bigfile command.
dn err d5 errwidth width-exp dn errup nn% errdown d4
For drawing error bars on a graph. The error bars can be
specified as an absolute value, as a percentage of the y
value, or as a dataset. The up and down error bars can be
specified separately e.g.,
d3 err .1
d3 err 10%
d3 errup 10% errdown d2
d3 err d1 errwidth .2
dn herr d5 herrwidth width-exp dn herrleft nn% errright d4
These commands are identical to the error bar commands
above except that they will draw bars in the horizontal
plane.
dn key "Dataset title"
If a dataset is given a title like this a key will be
drawn. Use the key command (below, after hscale) to set the
size and position of the key. Use the key module (Chapter
4) to draw more complex keys.
dn line
This tells GLE to draw lines between the points of the
dataset. By default GLE will not draw lines or markers,
this is often the reason for a blank graph.
If a dataset has missing values GLE will not draw a line to
the next real value, which leaves a gap in the curve. To
avoid this behavior simply use the nomiss qualifier on the
dn command used to define the line. This simply throws away
missing values so that lines are drawn from the last real
value to the next real value.
dn lstyle line-style lwidth line-width color col
These qualifiers are all fairly self explanatory. See the
lstyle command in Chapter~2 for details of specifying line
styles.
dn marker marker-name [msize marker-size] [mdata dn]
Specifies the marker to be used for the dataset. There is a
set of pre-defined markers (refer to Appendix A.1 for a
list) which can be specified by name (e.g., circle, square,
triangle, diamond, cross, ...). Markers can also be a
user-defined subroutine (See the define marker command in
Chapter 2). The mdata option allows a secondary dataset to
be defined which will be used to pass another parameter to
the marker subroutine, this allows each marker to be drawn
at a different angle,size or color.
The msize qualifier sets the marker size for that dataset.
The size is a character height in cm, so that the actual
size of the markers will be about 0.7 of this value.
dn nomiss
If a dataset has missing values, GLE will not draw a line
to the next real value, which leaves a gap in the curve. To
avoid this behavior simply use the nomiss qualifier on the
dn command used to define the line. This simply ignores
missing values.
dn smooth | smoothm
This will make GLE draw a smoothed line through the points.
A third degree polynomial is fitted piecewise to the given
points.
The smoothm alternative will work for multi valued
functions, i.e., functions which have more than one y value
for each x value.
dn xmin x-low xmax x-high ymin y-low ymax y-high
These commands map the dataset onto the graph's boundaries.
The data will be drawn as if the X axis was labelled from
x-low to x-high (regardless of how the axis is actually
labelled). A point in the dataset at X = x-low will appear
on the left hand edge of the graph.
fullsize
This is equivalent to vscale 1, hscale 1, noborder. It
makes the graph size command specify the size and position
of the axes instead of the size of the outside border.
hscale exp
Scales the length of the yaxis. See vscale. The default
value is 0.7.
key pos tl nobox hei exp offset xexp yexp
This command allows the features of a key to be specified.
The pos qualifier sets the position of the key. E.g.,
tl=topleft, br=bottomright, etc.
let ds = exp [ from low to high step exp ]
This command defines a new dataset as the result of an
expression on the variable x over a range of values. It
also allows the use of other datasets. E.g., to generate an
average of two datasets:
data aa.dat d1 d2
let d3 = d1+d2/2
Or to generate data from scratch:
let d1 = sin(x)+log(x) from 1 to 100 step 1
If the xaxis is a LOG axis then the step option is read as
the number of steps to produce rather than the size of each
step.
NOTE: The spacing around the `=' sign and the lack of
spaces inside the expression are necessary.
nobox
This removes the outer border from the graph.
size x y
Defines the size of the graph in cm. This is the size of
the outside box of a graph. The default size of the axes of
the graph will be 70% of this, (see vscale and hscale).
This command is required.
title "title" [hei ch-hei] [color col] [font font] [dist
cm]
This command gives the graph a centred title. The list of
optional keywords specifies features of it. The dist
command is used for moving the title up or down.
vscale exp
This sets the width of the axis relative to the width of
the graph. For example with a 10cm wide graph and a vscale
of .6 the x axis would be 6cm long. A setting of 1.0 makes
the xaxis the same length as the width of the graph, which
is useful for positioning some graphs. The default value is
0.7.
x2labels on
This command `activates' the numbering of the x2axis. There
is a corresponding command ` y2axis on' which will activate
y2axis numbering.
xaxis | yaxis | x2axis | y2axis
A graph is considered to have four axes: The normal xaxis
and yaxis as well as the top axis (x2axis) and the right
axis (y2axis).
Any command defining an xaxis setting will also define that
setting for the x2axis.
The secondary axes x2 and y2 can be modified individually
by starting the axis command with the name of that axis.
E.g.,
xaxis color col font font-name hei exp-cm lwidth exp-cm
These axis qualifiers affect the color, lstyle, lwidth, and
font used for drawing the xaxis (and the x2axis). These can
be overriden with more specific commands. E.g., ` xticks
color blue' would override the axis color when drawing the
ticks. The subticks would also be blue as they pick up tick
settings by default.
xaxis dsubticks sub-distance
See xaxis nticks below.
xaxis grid
This command makes the xaxis ticks long enough to reach the
x2axis and the yaxis ticks long enough to reach the y2axis.
When used with both the x and y axes this produces a grid
over the graph. Use the xticks lstyle command to create a
faint grid.
xaxis log
Draws the axis in logarithmic style, and scales the data
logarithmically to match (on the x2axis or y2axis it does
not affect the data, only the way the ticks and labelling
are drawn)
Be aware that a straight line should become curved when
drawn on a log graph. This will only happen if you have
enough points or have used the smooth option.
xaxis min low max high dpoints n
Sets the minimum and maximum values on the xaxis. This will
determine both the labelling of the axis and the default
mapping of data onto the graph. To change the mapping see
the dataset dn commands xmin, ymin, xmax, and ymax.
The dpoints option specifies the number of decimal points
that should be displayed. e.g. with a value of 3 these
numbers (0, 0.333333, 0.6666667, 1) would become (0.000,
0.333, 0.667, 1.000)
xaxis nofirst nolast
These two switches simply remove the first or last (or
both) labels from the graph. This is useful when the first
labels on the x and y axis are too close to each other.
xaxis nticks number dticks distance
nticks specifies the number of ticks along the axis. dticks
specifies the distance between ticks and dsubticks
specifies the distance between subticks. For example, to
get one subtick between every main tick with main ticks 3cm
apart, simply specify dsubticks 1.5.
By default ticks are drawn on the inside of the graph. To
draw them on the outside use the command:
xticks length -.2
yticks length -.2
xaxis off
Turns the whole axis off --- labels, ticks, subticks and
line. Often the x2axis and y2axis are not required, they
could be turned off with the following commands:
x2axis off
y2axis off
xaxis shift cm-exp
This moves the labelling to the left or right, which is
useful when the label refers to the data between the two
values.
xlabels font font-name hei char-hei color col
This command controls the appearance of the axis labels but
not the axis title.
xnames "name" "name" ...
This command replaces the numeric labelling with absolutely
anything. Given data consisting of five measurements, taken
from Monday to Friday, one per day then
xaxis min 0 max 6 dticks 1
xnames "" "Mon" "Tue" "Wed" "Thu" "Fri" ""
would give the desired result. Note it is essential to
define a specific axis minimum, maximum, dticks, etc.,
otherwise the labels may not correspond to the data.
If there isn't enough room on the line for all the names
then simply use an extra xnames command.
xplaces pos1 pos2 pos3 ...
This is similar to the xnames command but it specifies a
list of points which should be labelled. This allows
labelling which isn't equally spaced. The above example
with days of the week could be written like this:
xplaces 1 2 5
xplaces 7
xnames "Mon" "Tue" "Fri" "Sun"
If there isn't enough room on the line for all the names
then simply use an extra xplaces command.
xside color col lwidth line-width off
This command controls the appearance of the axis line, i.e.
the line to which the ticks are attached.
xsubticks lstyle num lwidth exp length exp off
This command gives fine control of the appearance of the
axis subticks.
xticks lstyle num lwidth exp length exp off
This command gives fine control of the appearance of the
axis ticks. Note: To get ticks on the outside of the graph,
i.e. pointing outwards, specify a negative tick length:
xticks length -.2
yticks length -.2
xtitle "title" [hei ch-hei] [color col] [font font] [dist
cm]
This command gives the axis a centered title. The list of
optional keywords specify features of it. The dist command
is used for moving the title up or down.
y2title "text-string" [rotate]
By default the y2title is written vertically upwards. The
optional rotate keyword changes this direction to
downwards. The rotate option is specific to the y2title
command.
commanddescription
Bar Graphs
----------
Drawing a bar graph is a subcommand of the normal graph
module. This allows bar and line graphs to be mixed. The
bar command is quite complex as it allows a great deal of
flexibility. The same command allows stacked, overlapping
and grouped bars.
For stacked bars use separate bar commands as in the first
example below:
bar d1 fill black
bar d2 from d1 fill grey10
For grouped bars put all the datasets in a list on a single
bar command:
bar d1,d2,d3 fill grey10,grey40,black
bar dx,... dist spacing
Specifies the distance between bars in dataset(s) dx,....
The distance is measured from the left hand side of one bar
to the left hand side of the next bar. A distance of less
than the width of a bar results in the bars overlapping.
bar dx,... from dy,...
This sets the starting point of each bar in datasets dx,...
to be at the value in datasets dy,..., and is used for
creating stacked bar charts. Each layer of the bar chart is
created with an additional bar command.
bar d1,d2
bar d3,d4 from d1,d2
bar d5,d6 from d3,d4
Note 1: It is important that the values in d3 and d4 are
greater than the values in d1 and d2.
Note 2: Data files for stacked bar graphs should not have
missing values, replace the * character with the number on
its left in the data file.
bar dn,... width xunits,... fill col,... color col,...
The rest of the bar qualifiers are fairly self explanatory.
When several datasets are specified, separate them with
commas (with no spaces between commas).
bar d1,d2 width 0.2 dist 0.2 fill grey10,grey20 color red,green
commanddescription
Filling Between Lines
---------------------
fill x1, d3 color green xmin val xmax val
Fills between the xaxis and a dataset, use the optional
xmin, xmax, ymin, ymax qualifiers to clip the filling to a
smaller region
fill d4,x2 color blue ymin val ymax val
This command fills from a dataset to the x2axis.
fill d3,d4 color green xmin val xmax val
This command fills between two datasets.
fill d4 color green xmin val xmax val
This command treats the dataset as a polygon and fills it.
The dataset should be a closed polygon.
commanddescription
Notes on Drawing Graphs
-----------------------
Importance of Order
Most of the graph commands can appear in any order, but in
some cases order is significant.
As some let commands operate on data which has been read
into datasets, the data commands should precede the let
commands.
The wildcard dn command should appear before specific d1
commands which it will override.
By default xaxis commands also change the x2axis, and
xlabels commands also change x2labels, so to specify
different settings for the x and x2 axes, put the x2
settings after the x settings.
begin graph
size 10 10
data a.dat
let d2 = d1*3
dn marker square lstyle 3 ! sets d1 and d2
d2 marker dot
xaxis color green
xticks color blue
x2axis color black
end graph
Line Width
When scaling a graph up or down for publication the default
line width may need changing. To do this simply specify a
set lwidth command before beginning the graph.
size 10 10
set lwidth .1
begin graph
...
end graph
The KEY module
--------------
This module is used for drawing keys for graphs. It is
completely separate from the graph module.
Specify a position for the key, the size of the lettering
and then for each dataset specify marker, color, lstyle and
fill pattern:
begin graph
...
end graph
begin key
hei .5
position tr
text "Green trees" marker heart msize .2 fill grey10
text "Red trees" lstyle 3 marker heart fill blue
text "Oranges" marker circle lstyle 6 fill black
end key
All commands to do with a particular line of the key module
MUST appear on the same line.
Key commands
------------
offset x-exp y-exp
Specifies the offset in cm from the current point to the
bottom left hand corner of the graph. This command should
be on a line of its own.
position justify-exp
This is an alternative to the OFFSET command. It allows you
to specify a position on the graph, e.g., tl = top left.
This command should be on a line of its own. See set just
for a list of justify settings.
text str-exp
The text which will be displayed on the end of the line.
lstyle style-num
The line style which will be used for the short line drawn
in the key.
marker marker-name
The marker which will be used for that line of the key.
msize exp
Specifies the size of the markers in cm.
mscale exp
Specifies how much to scale the size of the marker. E.g.,
0.5 would produce a marker half as big as normal.
color color-name
The colour of the text, line and marker.
hei cm-exp
This sets the height of the text used to draw the key. The
key will change in size to fit around the text. If you omit
this command the current font size is used.
fill fill-pattern
The fill pattern used in that line of the key.
commanddescription
Advanced features of GLE
------------------------
This chapter covers the advanced features of GLE. Some of
these features will not give exactly the same results on
the PC screen as you would get when printing to a
PostScript printer. E.g., clipping to an arbitrary shape is
only implemented in the PostScript driver but most other
features will give as close as possible representation
given the limitations of the screen.
Color
-----
Internally GLE treats color and fill identically, they are
simply an intensity of Red, Green and Blue. Each of the
predefined color names (yellow,grey20,orange,red) simply
define the ratio of red, green and blue.
There are two ways to use variables to show color, one is
for shades of grey:
for i = 0 to 10
box 3 .2 fill (i/10)
rmove 0 .2
next i
The other is for passing a color name as a variable:
sub stick c$
box .2 2 fill c$
end sub
@stick "green"
Remember a fill pattern completely obscures what is behind
it, so the following command would produce a box with a
shadow:
amove 4 4
box 3 2 fill grey10
rmove -.1 .1
box 3 2 fill white
rmove .4 .4
text hellow
Device Drivers
--------------
GLE supports the following devices.
Interactive: IBM/PC (BGI), VT100, REGIS (VT125, VT240),
TEK4010, VWS, XWindows.
Output: PostScript, HPGL, EPSON, EPSON 24pin, HP Deskjet.
Keyboard Mappings:
VT100 VT200 PC Meaning
GOLD 1 F11 F1 Help
GOLD 2 F12 F2 Save
GOLD 3 F13 F3 Load
GOLD 4 F14 F4 Save-as
GOLD 9 F9 F9 Graph-menu
GOLD 0 F10 F10 Draw-it
Control+Z Control+Z Control+Z Exit/Escape
Alt+X Exit/Escape
Control+E Control+E Calls VAX EDT
Control+F Control+F Toggle fast/slow text
Control+R Control+R F5 Shows errors
Control+S Shells to DOS
PC Screen Drivers
Remember that what you see on the screen isn't always what
you will get on the printer. For example filled regions
will not be filled, and some characters may not look right.
After pressing F10 and drawing the graph it can be
annotated by using the mouse (or arrow keys) to draw lines,
text and boxes. To draw lines simply click on the points of
the line, use the right hand mouse button to `pick up' the
pen.
To draw text press the letter `t' and then click on where
you would like the text to be drawn.
All movements are rounded to the grid size settings which
are 1.0cm, 0.1cm, 0.01cm etc.
The height and color of the text/lines is determined by the
current settings at the end of the GLE file.
If there is no mouse driver loaded then a cross-hair will
appear and it can be moved around using the arrow keys.
Press `c' to click, instead of the mouse button.
PostScript Driver
To print a GLE file to the laser printer type:
$ cgle myfile /print
or on a PC:
C:\GLE> psgle myfile
C:\GLE> print myfile.ps
The postscript drivers for GLE will automatically flip a
picture to best fit onto the page, e.g. a wide graph (as
defined by the size command at the top) will be drawn in
landscape mode and a tall thin graph will be drawn in
portrait mode.
To produce an .eps file on a VAX for inclusion in LaTeXor
WordPerfect you would type:
$ cgle myfile /dev=eps
On a PC you would type:
C:\GLE> psgle myfile /eps
(this creates myfile.eps, not myfile.ps)
Inside your LaTeXdocument use the LaTeXcommand:
\graphin{myfile.eps}{12.0cm}{3.0cm}{1.0}
The width and height are used by LaTeXto reserve enough
space for the drawing and the last parameter is a scale
factor.
The laser printer driver will draw all zero width lines
.02cm wide for any line width equal to zero, but if an
lwidth is greater than zero and less than or equal to .0001
then it will use a line width of 1 pixel. Without this it
would be impossible to specify a line width that didn't
occasionally get rounded to 2 pixels.
TEK4010 Driver
This driver allows initialization sequences to be defined
with the symbols TEK_OPEN and TEK_CLOSE.
On a VAX this is normally done by CGLECMD.COM so that when
you specify /DEV=V550 the assignments are done for you.
(V550 = Visual 550)
HPGL Driver
Device Drivers>HPGL Driver
This driver allows initialization sequences to be defined
in the symbols HPGL_OPEN and HPGL_CLOSE. On the PC use
environment variables and on the VAX use DCL symbols. Also
HPGL_WIDTH and HPGL_HEIGHT can be defined for non A3
plotters.
On a VAX this is normally done by CGLECMD.COM so that when
you specify /DEV=HPA4 the assignments are done for you.
The HPGL driver assigns the following colors to pen
numbers:
1=black, 2=red, 3=green, 4=blue, 5=magenta, 6=white
PC Bitmap Drivers
GLE supports the EPSON 8 and 24 pin and HP deskjet/laserjet
printers. To support bitmap devices which require a large
amount of memory GLE first writes a device independent file
OUT.DVI, then the appropriate bitmap driver for your
printer will read the OUT.DVI file and create a bitmap
which it then prints to LPT1:
C:> dvigle myfile (produces OUT.DVI)
C:> dviepson (creates bitmap and prints to LPT1:)
The output options are:
C:> dviepson Standard EPSON printers
C:> dviep24 24 Pin EPSON printers (180dpi)
C:> dvilj HP Laser jet, Desk jet (150 dpi)
C:> dvilj300 HP Laser jet, Desk jet (300 dpi)
The high resolution drivers (dviep24, dvilj300) are
significantly slower than the low resolution drivers so
would only be used for final output.
See the file AAREADME.GLE for the latest information on
drivers.
Fonts (font mapping)
By default the generic fonts (rm, rmb, ss, tt etc) will all
map to PLSR (plotter simplex roman) on BITMAP and HPGL
drivers. To make this happen on other drivers put the
command plotter fonts immediately after the size command at
the top of the GLE file.
A typical result of this change in fonts is that something
that lines up on the screen will not line up when printed
to an EPSON printer. If this happens then use the plotter
fonts command.
If a character is missing from a font, or isn't the
particular variation you like, you can define a character
to be from a different font in this way:
\chardef{%}{{\setfont{texcmr}\char{37}}}
\chardef{[}{{\setfont{texcmr}\char{91}}}
\chardef{]}{{\setfont{texcmr}\char{93}}}
On the PC some fonts may not be installed to save disk
space. When one of the missing fonts is called for, a
replacement font will be displayed, this may look terrible
and some special characters may be completely wrong.
More importantly if you use a font which does not have its
font metric file installed (e.g. C:/GLE/FONTS/PLSR.FMT)
then the PostScript driver will space the characters
incorrectly. This can be fixed by extracting that
particular metric file from the distribution file
CGLE_FVE.ZIP using PKUNZIP.
Diagrams, Joining Named Objects
-------------------------------
To draw lines between boxes which contain text, first name
each box as it is drawn and then use the join command to
draw the lines between the boxes.
box 2 3 fill blue name square
amove 5 5
begin box add .1 name titlebox
text Title
end box
join square.tr -> titlebox.bc
These commands draw a line from the ``Top Right'' of the
square to the ``Bottom Centre'' of the titlebox, with an
arrow at the titlebox end.
join square - titlebox
would draw a line from the centre of the square to the
centre of the titlebox but clipped correctly at the edges
of both boxes.
join square.tc <-> titlebox.v
would draw a vertical line from the top centre of the
square to the titlebox with arrows at both ends.
Named points on each box:
.bl Bottom left
.bc Bottom centre
.br Bottom right
.cr Centre right
.tr Top right
.tc Top centre
.tl Top left
.cl Centre left
.v Vertical line
.h Horizontal line
.cc Centre centre
.ci Circle clipping (for drawing lines to a circle)
To draw lines to a given point, simply move there and save
that point as a named object.
rmove 2 3
save apoint
join apoint - square
Filling, Stroking and Clipping Paths
------------------------------------
It is possible to set up arbitrary clipping regions. To do
this draw a shape and make it into a path by putting a
begin path clip ... end path, around it. Then draw the
things to be clipped by that region. To clear a clipping
path surround the whole section of GLE commands with begin
clip ... end clip
Characters can be used to make up clipping paths, but only
the PostScript fonts will currently work for this purpose.
Clipping doesn't work on the screen or p79 devices, but
does on the laser printer. See example CLIP.GLE at end of
manual.
size 10 5
begin clip ! Save current clipping path
begin path clip stroke ! Define new clipping region
amove 2 2
box 3 3
amove 6 2
box 3 3
end path
amove 2 2
set hei 3
text Here is clipped text
end clip ! Restore original clipping path
Using Variables
---------------
GLE has two types of variables, floating point and string.
String variables always end with a dollar sign. A string
variable contains text like ``Hello this is text'', a
floating point variable can only contain numbers like
1234.234.
name$ = "Joe"
height = 6.5 ! Height of person
shoe = .05 ! shoe adds to height of person
amove 1 1
box .2 height+shoe
write name$
Programming Loops
-----------------
The simple way to draw a 6 $$ 8 grid would be to use a
whole mass of line commands:
amove 0 0
rline 0 8
amove 1 0
rline 1 8
...
amove 6 0
rline 6 8
this would be laborious to type in, and would become
impossible to manage with several grids. By using a simple
loop this can be avoided:
for x = 0 to 6
amove x 0
rline x 8
next x
for y = 0 to 8
amove 0 y
rline 6 y
next y
To draw lots of grids all of different dimensions a
subroutine can be defined and then used again and again:
! define the subroutine
sub grid nx ny
gsave
begin origin
for x = 0 to nx
amove x 0
aline x ny
next x
for y = 0 to ny
amove 0 y
aline nx y
next y
end origin
end sub
! now draw the grids wherever
amove 2 4
@grid 6 8
amove 2 2
@grid 9 5
Now the main GLE file will be much easier to modify
particularly if the subroutine definition is moved into a
separate file:
size 10 10
include griddef.gle
amove 2 4
@grid 2 4
amove 2 2
@grid 9 5
Tables
------
Markers
-------
Fonts
-----
font-name Description
rm Roman
rmb Roman Bold
rmi Roman Italic
ss San Serif
ssb San Serif Bold
ssi San Serif Italic
tt Typewriter
ttb Typewriter Bold
tti Typewriter Italic
font-name Description
psagb AvantGarde-Book
psagbo AvantGarde-BookOblique
psbd Bookman-Demi
psbdi Bookman-DemiItalic
psbl Bookman-Light
psbli Bookman-LightItalic
psc Courier
pscb Courier-Bold
pscbo Courier-BoldOblique
psco Courier-Oblique
psh Helvetica
pshb Helvetica-Bold
pshbo Helvetica-BoldOblique
psho Helvetica-Oblique
psncsb NewCenturySchlbk-Bold
psncsi NewCenturySchlbk-Italic
psncsr NewCenturySchlbk-Roman
pspr Palatino-Roman
pstr Times-Roman
psti Times-Italic
pstb Times-Bold
pstbi Times-BoldItalic
pszcmi ZapfChancery-MediumItalic
pszd ZapfDingbats
pssym Symbol
font-name Description
texcmb Computer Modern Bold
texcmex Computer Modern Extensible
texcmitt Computer Modern Italic Typewriter
texcmmi Computer Modern Maths Italic
texcmr Computer Modern Roman
texcmss Computer Modern Sans Serif
texcmssb Computer Modern Sans Serif Bold
texcmssi Computer Modern Sans Serif Italic
texcmsy Computer Modern Symbol
texcmti Computer Modern Text Italic
texcmtt Computer Modern Typewriter Text
font-name Description
plcc Complex Cartographic
plcg Complex Gothic
plci Complex Italic
plcr Complex Roman
plcs Complex Script
pldr Duplex Roman
plge Gothic English
plgg Gothic German
plgi Gothic Italian
plsa Simplex Ascii
plsg Simplex German
plsr Simplex Roman
plss Simplex Script
plsym1 Symbols one
plsym2 Symbols two
plti Triplex Italic
pltr Triplex Roman
plba Block Ascii
Functions
---------
Function Name Returns
TIME$() current time e.g. ``11:44:27''
DATE$() current date e.g. ``Tue Apr 09 1991''
LEFT$(str$,exp) left exp characters of str$
RIGHT$(str$,exp) rest of str$ starting at exp
SEG$(str$,exp1,exp2) str$ from exp1 to exp2
NUM$(exp) string representation of exp
NUM1$(exp) as above but with no spaces
VAL(str$) value of the string str$
POS(str1$,str2$,exp) position of str2$ in str1$ from exp
LEN(str$) the length of str$
Function Name Returns
ABS(exp) absolute value of expression
ATN(exp) arctan
COS(exp) cosine
EXP(exp) exponent
FIX(exp) exp rounded towards 0
INT(exp) integer part of exp
LOG(exp) log to base e of exp
LOG10(exp) log to base 10 of exp
SGN(exp) returns 1 or -1.
SIN(exp) sine of exp
SQR(exp) exp squared
TAN(exp) tangent of exp
NOT(exp) logical not of exp
RND(exp) random number from seed exp
SQRT(exp) square root of exp
Function Name Returns
XEND() the x end point of a text string when drawn
YEND() the y end point of a text string when drawn
XPOS() the current x point
YPOS() the current y point
TWIDTH(str$) the width of str$ assuming current font, size
THEIGHT(str$) the height of str$ assuming current font, size
TDEPTH(str$) the depth of str$
XG(xexp) converts units of last graph to abs cm.
YG(yexp) converts units of last graph to abs cm. tabular